From d287b71399f7eecc79fc8379730c9ecc6bf0da5c Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 5 Jun 2004 03:58:50 +0000 Subject: [PATCH] Add a note about the !CAN_FOCUS quirk in the button size allocation code. 2004-06-04 Matthias Clasen * docs/widget_geometry.txt: Add a note about the !CAN_FOCUS quirk in the button size allocation code. * gtk/gtkbutton.c (gtk_button_size_allocate): Give the space requested for drawing the focus indicator to the child in the !CAN_FOCUS case. This should fix issues which the Gimp has with the button allocation changes in 2.4.2. --- ChangeLog | 10 ++++++++++ ChangeLog.pre-2-10 | 10 ++++++++++ ChangeLog.pre-2-6 | 10 ++++++++++ ChangeLog.pre-2-8 | 10 ++++++++++ docs/widget_geometry.txt | 5 +++++ gtk/gtkbutton.c | 11 +++++++---- 6 files changed, 52 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index c53a74a920..1dcf0753e2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2004-06-04 Matthias Clasen + + * docs/widget_geometry.txt: Add a note about the !CAN_FOCUS + quirk in the button size allocation code. + + * gtk/gtkbutton.c (gtk_button_size_allocate): Give the space + requested for drawing the focus indicator to the child in the + !CAN_FOCUS case. This should fix issues which the Gimp has with + the button allocation changes in 2.4.2. + Thu Jun 3 21:17:29 2004 Matthias Clasen * gtk/gtkentry.c (gtk_entry_completion_timeout): Calculate the diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index c53a74a920..1dcf0753e2 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,13 @@ +2004-06-04 Matthias Clasen + + * docs/widget_geometry.txt: Add a note about the !CAN_FOCUS + quirk in the button size allocation code. + + * gtk/gtkbutton.c (gtk_button_size_allocate): Give the space + requested for drawing the focus indicator to the child in the + !CAN_FOCUS case. This should fix issues which the Gimp has with + the button allocation changes in 2.4.2. + Thu Jun 3 21:17:29 2004 Matthias Clasen * gtk/gtkentry.c (gtk_entry_completion_timeout): Calculate the diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index c53a74a920..1dcf0753e2 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,13 @@ +2004-06-04 Matthias Clasen + + * docs/widget_geometry.txt: Add a note about the !CAN_FOCUS + quirk in the button size allocation code. + + * gtk/gtkbutton.c (gtk_button_size_allocate): Give the space + requested for drawing the focus indicator to the child in the + !CAN_FOCUS case. This should fix issues which the Gimp has with + the button allocation changes in 2.4.2. + Thu Jun 3 21:17:29 2004 Matthias Clasen * gtk/gtkentry.c (gtk_entry_completion_timeout): Calculate the diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index c53a74a920..1dcf0753e2 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,13 @@ +2004-06-04 Matthias Clasen + + * docs/widget_geometry.txt: Add a note about the !CAN_FOCUS + quirk in the button size allocation code. + + * gtk/gtkbutton.c (gtk_button_size_allocate): Give the space + requested for drawing the focus indicator to the child in the + !CAN_FOCUS case. This should fix issues which the Gimp has with + the button allocation changes in 2.4.2. + Thu Jun 3 21:17:29 2004 Matthias Clasen * gtk/gtkentry.c (gtk_entry_completion_timeout): Calculate the diff --git a/docs/widget_geometry.txt b/docs/widget_geometry.txt index dbb2de84d7..7298ff4b68 100644 --- a/docs/widget_geometry.txt +++ b/docs/widget_geometry.txt @@ -271,6 +271,11 @@ GtkButton ===================== +NOTE: Due to a bug that is basically unfixable in a sufficiently compatible +NOTE: way, the button gives the space requested for focus_width and +NOTE: focus_padding to the child (in addition to the space requested by +NOTE: the child), if the button is !CAN_FOCUS. + Style properties GtkWidget::interior_focus = TRUE diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c index 02cc192320..72c2117816 100644 --- a/gtk/gtkbutton.c +++ b/gtk/gtkbutton.c @@ -966,10 +966,13 @@ gtk_button_size_allocate (GtkWidget *widget, child_allocation.height = MAX (1, child_allocation.height - default_border.top - default_border.bottom); } - child_allocation.x += focus_width + focus_pad; - child_allocation.y += focus_width + focus_pad; - child_allocation.width = MAX (1, child_allocation.width - (focus_width + focus_pad) * 2); - child_allocation.height = MAX (1, child_allocation.height - (focus_width + focus_pad) * 2); + if (GTK_WIDGET_CAN_FOCUS (button)) + { + child_allocation.x += focus_width + focus_pad; + child_allocation.y += focus_width + focus_pad; + child_allocation.width = MAX (1, child_allocation.width - (focus_width + focus_pad) * 2); + child_allocation.height = MAX (1, child_allocation.height - (focus_width + focus_pad) * 2); + } if (button->depressed) { -- 2.30.2